<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    var myPow = function (x, n) {
      if (n == 0) return 1;
      if (n < 0) return 1 / myPow(x, -n);
      if (n % 2) return x * myPow(x, n - 1);
      return myPow(x * x, n / 2);
    };
    console.log(myPow(x = 2.00000, n = 10));
  </script>
</body>

</html>